﻿@using SkiaSharp.Views.Blazor;
@using SkiaSharp;
@inherits BlazorPlotBase

<div oncontextmenu="return false;"
     onmousewheel="return false;"
     onmousedown="return false;"
     style=@Style>
    <SKCanvasView @ref="SKView"
                  style="width:inherit; height:inherit;"
                  OnPaintSurface="OnPaintSurface"
                  IgnorePixelScaling="true"
                  EnableRenderLoop="EnableRenderLoop"
                  @onpointerdown="OnPointerPressed"
                  @onpointermove="OnPointerMoved"
                  @onpointerup="OnPointerReleased"
                  @onwheel="OnPointerWheelChanged"
                  @onkeydown="OnKeyDown"
                  @onkeyup="OnKeyUp" />
</div>

@code {

    private SKCanvasView SKView { get; set; } = new();

    public void OnPaintSurface(SKPaintSurfaceEventArgs e)
    {
        Multiplot.Render(e.Surface);
    }


    public override void Refresh()
    {
        SKView.Invalidate();
    }

}